'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const dataList = {
      list: [
        { id: 1, title: 'this is news 1', url: '/news/1' },
        { id: 2, title: 'this is news 2', url: '/news/2' }
      ]
    };
    const content1s = await this.ctx.service.admin.showcontent1();
    dataList.content1s=content1s;
    const content2s = await this.ctx.service.admin.showcontent2();
    dataList.content2s=content2s;
    const content3s = await this.ctx.service.admin.showcontent3();
    dataList.content3s=content3s;
    const content4s = await this.ctx.service.admin.showcontent4();
    dataList.content4s=content4s;
    const content5s = await this.ctx.service.admin.showcontent5();
    dataList.content5s=content5s;

    const image1s = await this.ctx.service.admin.showImage1();
    dataList.image1s = image1s;
    const image2s = await this.ctx.service.admin.showImage2();
    dataList.image2s = image2s;
    const image3s = await this.ctx.service.admin.showImage3();
    dataList.image3s = image3s;
    const image4s = await this.ctx.service.admin.showImage4();
    dataList.image4s = image4s;
    const image5s = await this.ctx.service.admin.showImage5();
    dataList.image5s = image5s;
    const image6s = await this.ctx.service.admin.showImage6();
    dataList.image6s = image6s;
    const image7s = await this.ctx.service.admin.showImage7();
    dataList.image7s = image7s;
    const image8s = await this.ctx.service.admin.showImage8();
    dataList.image8s = image8s;
    await this.ctx.render('home.html', {dataList});
  }
}

module.exports = HomeController;
